package ch03.iphone;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class InrwemediaryMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        before();
        Object msg=methodProxy.invokeSuper(o,objects);
        after();
        return msg;
    }
    public void before(){
        System.out.println("查看手机配置");
        System.out.println("刷了一下pos机");

    }
    public void after(){
        System.out.println("完成付款");
        System.out.println("购买成功");
    }
}
